#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
struct cj
{
    int xh;
    char name[20];
    int score[5];
    int sum;
}s[101];
void scanf1(int n);
void Sum(int n);
void print1(int n);
int main()
{
    int n = 0;
    scanf("%d", &n);
    scanf1(n);
    Sum(n);
    print1(n);
    return 0;
}
void scanf1(int n)
{
    int i = 0;
    scanf("%d", &s[i].xh);
    scanf("%s", s[i].name);
    for (i = 0; i < n; i++)
    {
        scanf("%d", &s[i].xh);
        scanf("%s", s[i].name);
        for (int j = 0; j < 5; j++)
        {
            scanf("%d", &s[i].score[j]);
        }
    }
}
void Sum(int n)
{
    int i = 0;
    for (i = 0; i < n; i++)
    {
        int sum1 = 0;
        for (int j = 0; j < 5; j++)
        {
            sum1 += s[i].score[j];
        }
        s[i].sum = sum1;
    }
}
void print1(int n)
{
    int i = 0;
    for (i = 0; i < n; i++)
    {
        printf("%5d", s[i].xh);
        printf("%10s", s[i].name);
        for (int j = 0; j < 5; j++)
        {
            printf("%5d", s[i].score[j]);
        }
        printf("%10d", s[i].sum);
        if (i + 1 < n)
            printf("\n");
    }
}